<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>用户登录 - 校园二手市场</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: "Noto Serif SC", "Source Han Serif SC", "SimSun",
            "Times New Roman", serif;
        }

        body {
            background-color: #f5f5f5;
            color: #333;
            line-height: 1.6;
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }

        a {
            text-decoration: none;
            color: inherit;
        }

        .login-header {
            background-color: #2c3e50;
            color: white;
            padding: 25px 0;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
        }

        .login-header .container {
            display: flex;
            justify-content: center;
            align-items: center;
            max-width: 1400px;
            margin: 0 auto;
            padding: 0 30px;
        }

        .logo {
            margin-left: 110px;
            display: flex;
            align-items: center;
        }

        .logo h1 {
            font-size: 2.8rem;
            font-weight: 700;
            min-width: 400px;
            letter-spacing: 1.5px;
            text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
        }

        .logo i.fa-recycle {
            font-size: 3.2rem;
            margin-right: 20px;
            color: #e74c3c;
        }

        .login-main {
            flex: 1;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 60px 0;
        }

        .login-container {
            background-color: white;
            padding: 60px;
            border-radius: 12px;
            box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
            width: 100%;
            max-width: 600px;
            margin: 0 30px;
            position: relative;
            overflow: hidden;
        }

        .login-container::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 8px;
            height: 100%;
            background: linear-gradient(to bottom, #e74c3c, #3498db);
        }


        .return-btn {
            width: 100%;
            padding: 15px;
            background: linear-gradient(to right, #3498db, #2980b9);
            color: white;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: 1.3rem;
            font-weight: 600;
            transition: all 0.3s;
            box-shadow: 0 6px 10px rgba(0, 0, 0, 0.1);
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .return-btn:hover {
            background: linear-gradient(to right, #2980b9, #3498db);
            box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
            transform: translateY(-3px);
        }

        .return-btn i {
            margin-right: 10px;
        }

        /* 调整登录按钮样式 */
        button[type="submit"] i {
            margin-right: 10px;
        }

        h2 {
            text-align: center;
            margin-bottom: 45px;
            color: #2c3e50;
            font-size: 2.4rem;
            position: relative;
            padding-bottom: 20px;
        }

        h2::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 50%;
            transform: translateX(-50%);
            width: 120px;
            height: 4px;
            background: linear-gradient(to right, #e74c3c, #3498db);
        }

        .form-group {
            margin-bottom: 35px;
            position: relative;
        }

        label {
            display: block;
            margin-bottom: 15px;
            font-weight: 600;
            color: #2c3e50;
            font-size: 1.2rem;
            display: flex;
            align-items: center;
        }

        label i {
            margin-right: 15px;
            color: #7f8c8d;
            font-size: 1.2rem;
        }

        input[type="text"],
        input[type="password"] {
            width: 100%;
            padding: 18px 20px 18px 55px;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            box-sizing: border-box;
            font-size: 1.2rem;
            transition: all 0.3s;
            background-color: #f9f9f9;
        }

        input[type="text"]:focus,
        input[type="password"]:focus {
            border-color: #e74c3c;
            outline: none;
            box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.1);
            background-color: white;
        }

        .input-icon {
            position: absolute;
            left: 20px;
            top: 68px;
            color: #7f8c8d;
            font-size: 1.3rem;
        }

        button[type="submit"] {
            width: 100%;
            padding: 18px;
            background: linear-gradient(to right, #e74c3c, #c0392b);
            color: white;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: 1.3rem;
            font-weight: 600;
            transition: all 0.3s;
            margin-top: 20px;
            box-shadow: 0 6px 10px rgba(0, 0, 0, 0.1);
        }

        button[type="submit"]:hover {
            background: linear-gradient(to right, #c0392b, #e74c3c);
            box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
            transform: translateY(-3px);
        }

        .error-message {
            color: #e74c3c;
            text-align: center;
            margin: 30px 0;
            font-size: 1.1rem;
            padding: 15px;
            background-color: rgba(231, 76, 60, 0.1);
            border-radius: 8px;
            border-left: 5px solid #e74c3c;
        }

        .success-message {
            color: #27ae60;
            text-align: center;
            margin: 30px 0;
            font-size: 1.1rem;
            padding: 15px;
            background-color: rgba(39, 174, 96, 0.1);
            border-radius: 8px;
            border-left: 5px solid #27ae60;
        }

        .register-link {
            text-align: center;
            margin-top: 35px;
            font-size: 1.2rem;
            color: #7f8c8d;
        }

        .register-link a {
            color: #3498db;
            text-decoration: none;
            font-weight: 600;
            transition: all 0.3s;
            display: inline-flex;
            align-items: center;
            padding: 12px 25px;
            border-radius: 30px;
        }

        .register-link a:hover {
            color: #e74c3c;
            background-color: rgba(231, 76, 60, 0.1);
        }

        .register-link i {
            margin-right: 12px;
            font-size: 1.1rem;
        }

        .login-footer {
            text-align: center;
            padding: 25px;
            color: #7f8c8d;
            font-size: 1rem;
            background-color: #f0f0f0;
        }

        @media (max-width: 992px) {
            .logo h1 {
                font-size: 2.4rem;
            }

            .logo i.fa-recycle {
                font-size: 2.8rem;
            }

            .login-container {
                padding: 50px 40px;
                max-width: 550px;
            }

            h2 {
                font-size: 2.1rem;
            }
        }

        @media (max-width: 768px) {
            .logo h1 {
                font-size: 2rem;
            }

            .logo i.fa-recycle {
                font-size: 2.4rem;
                margin-right: 15px;
            }

            .login-container {
                padding: 45px 35px;
                max-width: 500px;
            }

            h2 {
                font-size: 1.8rem;
            }

            input[type="text"],
            input[type="password"] {
                padding: 16px 18px 16px 50px;
                font-size: 1.1rem;
            }
        }

        @media (max-width: 576px) {
            .logo h1 {
                font-size: 1.8rem;
            }

            .logo i.fa-recycle {
                font-size: 2rem;
                margin-right: 12px;
            }

            .login-container {
                padding: 40px 30px;
                margin: 0 20px;
            }

            h2 {
                font-size: 1.6rem;
                margin-bottom: 35px;
            }

            label {
                font-size: 1.1rem;
            }

            button[type="submit"] {
                padding: 16px;
                font-size: 1.2rem;
            }

            .register-link {
                font-size: 1.1rem;
            }
        }
    </style>
</head>
<body>
<header class="login-header">
    <div class="container">
        <div class="logo">
            <a href="${pageContext.request.contextPath}/home"><i class="fas fa-recycle"></i></a>
            <a href="${pageContext.request.contextPath}/home"><h1>校园二手市场</h1></a>
        </div>
    </div>
</header>

<main class="login-main">
    <div class="login-container">
        <h2><i class="fas fa-sign-in-alt"></i> 用户登录</h2>
        <form action="${pageContext.request.contextPath}/login" method="post">
            <div class="form-group">
                <label for="username"><i class="fas fa-user"></i> 用户名:</label>
                <i class="fas fa-user input-icon"></i>
                <input type="text" id="username" name="username" required placeholder="请输入用户名">
            </div>
            <div class="form-group">
                <label for="password"><i class="fas fa-lock"></i> 密码:</label>
                <i class="fas fa-lock input-icon"></i>
                <input type="password" id="password" name="password" required placeholder="请输入密码">
            </div>
            <div class="form-group">
                <button type="submit"><i class="fas fa-sign-in-alt"></i> 登录</button>
            </div>
            <a href="${pageContext.request.contextPath}/home" class="return-btn">
                <i class="fas fa-arrow-left"></i> 返回首页
            </a>
            <c:if test="${not empty error}">
                <div class="error-message">${error}</div>
            </c:if>
            <c:if test="${not empty successRegister}">
                <div class="success-message">${successRegister}</div>
            </c:if>
        </form>
        <div class="register-link">
            没有账号？<a href="${pageContext.request.contextPath}/register"><i class="fas fa-user-plus"></i> 立即注册</a>
        </div>
    </div>
</main>

<footer class="login-footer">
    <div class="container">
        <p>&copy; 2025 CB 校园二手市场 版权所有</p>
    </div>
</footer>
</body>
</html>